package tools;
import js.Lib;

/**
 * ...
 * @author PRASS
 */

class BoundProvider 
{

	static public var winW 	: Int;
	static public var winH 	: Int;
	
	static public var bgW 	: Int;
	static public var bgH 	: Int;
	static public var bgX 	: Int;
	static public var bgY 	: Int;
	
	static private var _screen	: Float;
	static private var _content	: Float;
	
	public function new() {}
	
	static public function getBounds() : Void
	{		
		/*if (document.compatMode=='CSS1Compat' && document.documentElement && document.documentElement.offsetWidth ) {
			winW = document.documentElement.offsetWidth;
			winH = document.documentElement.offsetHeight;
		}*/
			
		winW = Lib.window.innerWidth;
		winH = Lib.window.innerHeight;

		_content = 16 / 9;
		
		getBackgroundSize();
	}
	
	static private function getBackgroundSize() : Void
	{
		_screen = winW / winH;
		
		if ( _screen >= _content )
		{
			bgW 	=  winW;
			bgH		= cast (winW / 16) * 9;
			
		} else {
			
			bgW 	=  cast (winH / 9) * 16;
			bgH		=  winH;
		}
		
		bgX = cast ( ( winW - bgW	) * .5 );
		bgY = cast ( ( winH - bgH	) * .5 );
	}
	
}